<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="<%=request.getContextPath()%>/image/LOGO.png" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/util.css" />
<title>病案图像查询</title>
</head>
<body>
 
<div class="easyui-panel" data-options="fit:true,border:0">
	<div id="toolbar-previewList" class="paddingTBL">
		    <div class="paddingB">
		        <label>主治医生&nbsp;</label>
				<input type="text" class="" id="previewList_fzzDoc" data-options="width:120,height:24"/>
		    	<label class="paddingL">出院科室&nbsp;</label>
				<input type="text" class="" id="previewList_fcydept" data-options="width:120,height:24"/>
			    <label class="paddingL">出院日期&nbsp;</label>
				<input type="text" class="easyui-datebox" id="previewList_date1" data-options="width:115,height:24"/>
				<label>&nbsp;至&nbsp;</label>
				<input type="text" class="easyui-datebox" id="previewList_date2" data-options="width:115,height:24"/>
		    </div>
			<div class="paddingB">
		    	<label class="labelWid4">病案号&nbsp;</label>
				<input type="text" class="easyui-textbox" id="previewList_fprn" data-options="width:120,height:24"/>
				<label class="labelWid4 paddingL">条码号&nbsp;</label>
				<input type="text" class="easyui-textbox" id="previewList_fbarcode" data-options="width:120,height:24"/>
				<label class="paddingL">疾病&nbsp;</label>
				<input type="text" class="" id="previewList_fjb" data-options="width:180,height:24"/>
			</div>
			<div class="">
				<label class="">病案分类&nbsp;</label>
				<input type="text" class="" id="previewList_category" data-options="width:120,height:24"/>
		    	<label class="labelWid4 paddingL">姓&nbsp;名&nbsp;</label>
				<input type="text" class="easyui-textbox" id="previewList_fname" data-options="width:120,height:24"/>
				<label class="paddingL">性别&nbsp;</label>
				<select class="easyui-combobox" id="previewList_fsex" data-options="width:60,height:'auto'">
					<option value="0" selected="selected">全部</option>
		            <option value="1" >男</option>
		            <option value="2">女</option>
				</select>
				<label class="paddingL">次数&nbsp;</label>
				<input type="text" class="easyui-numberbox" id="previewList_ftimes" data-options="width:60,height:24"/>
			
				<!-- <label>查询范围</label>
				<select class="easyui-combobox" id="previewList_fpermission" data-options="width:120,height:24">
					<option value="0" selected="selected">全部</option>
		            <option value="1">有权限</option>
		            <option value="2">无权限</option>
		            <option value="3">未翻拍</option>
		            <option value="4">有权限未翻拍</option>
		            <option value="5">已翻拍无权限</option>
				</select> -->
				<span class="paddingL"></span>
				<a href="#" class="easyui-linkbutton" onclick="previewListSearch()">检 索</a>
			</div>
		</div>
	 
		<table id="previewListGrid"></table>
</div>  

<script type="text/javascript" >

	$(function(){
		//获取出院科室
		$("#previewList_fcydept").combobox({
			url:ctx + "/MedicalShootManage/getDept",
			valueField:"ftykh",
			textField:"fksname",
			width:120, 
			height:24,
			onLoadSuccess : function() {
				$('#previewList_fcydept').combobox('select', 'TZYQY');
			}
		});
		
		//获取主治医生
		$("#previewList_fzzDoc").combobox({
			url:ctx + "/MedicalShootManage/getZzDoc",
			valueField:"fzzdoctbh",
			textField:"fzzdoct",
			width:120, 
			height:24
		});
		
		//获取病案分类
		$("#previewList_category").combobox({
			url:ctx + "/MedicalShootManage/getCategory",
			valueField:"fcode",
			textField:"fname",
			width:120, 
			height:24
		});
		
		//获取疾病
		$("#previewList_fjb").combobox({
			url:ctx + "/MedicalShootManage/getJB",
			valueField:"ficdrange",
			textField:"fname",
			width:290, 
			height:24,
			onLoadSuccess : function() {
				$('#previewList_fjb').combobox('select', '');
			}
		});
		
		//加载数据表格
		$("#previewListGrid").datagrid({
			url:'',
			toolbar:"#toolbar-previewList",
			rownumbers:true,
			fitColumns:true,
			border : false,
			striped : true,
			fit : true,
			singleSelect: true,
			pagination : true,
			pageSize : 20,
			pageList : [ 20, 30,50 ],
			columns:[[
	            {field:'operat',title:'操作',width:80,align:'center',
	            	formatter:function(value,row,index){
	            		return "<button class='shootBtn' onclick='picture_preview("+index+")'>查看</button>";
	            	}
	            },  
				{field:'fprn',title:'病案号',width:120,align:'center'},  
				{field:'fzyid',title:'住院ID',width:100,align:'center'},  
				{field:'ftimes',title:'次数',width:50,align:'center' },  
				{field:'fname',title:'姓名',width:80,align:'center' },  
				{field:'fsex',title:'性别',width:50,align:'center' },  
				{field:'fbirthday',title:'出生日期',width:100,align:'center',
					formatter:function(value){
						return new Date(value).format("yyyy-MM-dd");
					}
				},  
				{field:'fbarcode',title:'条码号',width:160,align:'center' },  
				{field:'fcydate',title:'出院日期',width:100,align:'center',
					formatter:function(value){
						return new Date(value).format("yyyy-MM-dd");
					}
				},  
				{field:'frydept',title:'入院科室',width:100,align:'center' },  
				{field:'fcydept',title:'出院科室',width:100,align:'center' },  
				{field:'frydate',title:'入院日期',width:100,align:'center',hidden:true,
					formatter:function(value){
						return new Date(value).format("yyyy-MM-dd");
					}	
				} 
			 ]]
		});
		
	});
	
	//查询数据
	function previewListSearch(){
		var date1 = $("#previewList_date1").datebox("getValue");
		var date2 = $("#previewList_date2").datebox("getValue");
		var fcydept = $("#previewList_fcydept").combobox("getValue");
		var fzzDoc = $("#previewList_fzzDoc").combobox("getValue");
		var fprn = $("#previewList_fprn").textbox("getValue");
		var ftimes = $("#previewList_ftimes").numberbox("getValue");
		var fbarcode = $("#previewList_fbarcode").textbox("getValue");
		var fjb = $("#previewList_fjb").combobox("getValue");
		var fname = $("#previewList_fname").textbox("getValue");
		var fsex = $("#previewList_fsex").textbox("getValue");
		var category = $("#previewList_category").combobox("getValue");
		$("#previewListGrid").datagrid({
			url:ctx + "/MedicalShootManage/previewListSearch",
			queryParams:{
				"date1" : date1,
				"date2" : date2,
				"fcydept" : fcydept,
				"fzzDoc" : fzzDoc,
				"fprn" : fprn,
				"ftimes" : ftimes,
				"fbarcode" : fbarcode,
				"fname" : fname,
				"fsex" : fsex,
				"category" : category,
				"fjb" :fjb
			}
		});
	};
	
	//查看图片
	function picture_preview(index){
		var rows = $("#previewListGrid").datagrid("getRows")[index];
		var fcydate = new Date(rows.fcydate).format("yyyy-MM-dd");
		var url= ctx + "/MedicalShootManage/PicturePreview?fprn="+rows.fprn+"&fzyid="+rows.fzyid+"&ftimes="+rows.ftimes+"&fname="+encodeURI(encodeURI(rows.fname))+"&fcydate="+fcydate;
		addTab("数字化病案浏览", url,"", false);
		
	}
</script>
	
</body>
</html>